package com.github.kotvertolet.youtubejextractor.models.youtube.videoData;

import com.google.gson.annotations.SerializedName;
import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

import java.io.Serializable;
import java.util.List;


public class Thumbnail implements Sequenceable, Serializable {

    @SerializedName("thumbnails")
    private List<ThumbnailsItem> thumbnails;

    public static final Sequenceable.Producer<Thumbnail> CREATOR = new Producer<Thumbnail>() {
        @Override
        public Thumbnail createFromParcel(Parcel parcel) {
            // Initialize an instance first, then do customized unmarshlling.
            Thumbnail thumbnail = new Thumbnail();
            thumbnail.unmarshalling(parcel);
            return thumbnail;
        }
    };

    public Thumbnail() {
    }

    public Thumbnail(List<ThumbnailsItem> thumbnails) {
        this.thumbnails = thumbnails;
    }


    public List<ThumbnailsItem> getThumbnails() {
        return thumbnails;
    }

    public void setThumbnails(List<ThumbnailsItem> thumbnails) {
        this.thumbnails = thumbnails;
    }

    @Override
    public String toString() {
        return
                "Thumbnail{" +
                        "thumbnails = '" + thumbnails + '\'' +
                        "}";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Thumbnail)) return false;

        Thumbnail thumbnail = (Thumbnail) o;

        return thumbnails != null ? thumbnails.equals(thumbnail.thumbnails) : thumbnail.thumbnails == null;
    }

    @Override
    public int hashCode() {
        return thumbnails != null ? thumbnails.hashCode() : 0;
    }


    @Override
    public boolean marshalling(Parcel parcel) {
        parcel.writeList(this.thumbnails);
        return true;
    }

    @Override
    public boolean unmarshalling(Parcel parcel) {
        this.thumbnails = parcel.readSequenceableList(ThumbnailsItem.class);
        return true;
    }
}